//
//  ToutiaoImageModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 liu. All rights reserved.
//

#import "ToutiaoImageModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@implementation ToutiaoImageModelCell


-(void)setModel:(ToutiaoImageModel *)model {
    if (_model != model) {
        _model = model;
    }
}

- (void)layoutSubviews {
    self.titleLable.text = self.model.title;
    self.resourceLable.text = self.model.source;
    [self.imgsrcView sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    NSString *special = self.model.specialID;
    NSString *video = self.model.videoID;
    NSString *photo = self.model.photosetID;
    NSString *tag = self.model.TAG;
    
    if (special) {
        self.replyCountLable.text = @"专题";
    } else if (video) {
        self.replyCountLable.text = @"视频";
    } else if (photo) {
        self.replyCountLable.text = @"图集";
    } else if (tag) {
//        self.replyCountLable.text = tag;
    } else {
        self.replyCountLable.text = [NSString stringWithFormat:@"%@跟帖",self.model.replyCount];
    }
    
    self.imgsrcView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imgsrcViewAction:)];
    [self.imgsrcView addGestureRecognizer:tap];
    
}
- (void)imgsrcViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imgsrcView];
}

+ (CGFloat)height {
    return 130;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
